import { request, useUserStore } from "jmash-core";
import type { AxiosPromise } from "axios";
import type {
  CommentApi,
  FlowHiCommentList,
  FlowHiCommentReq,
  HiCommentKey,
  FlowHiCommentModel,
} from "./types";

class CommentApiImpl implements CommentApi {
  getKey(model: FlowHiCommentModel): HiCommentKey {
    return {
      commentId: model.id,
    } as HiCommentKey;
  }
  // 查询流程实例历史办理记录
  findList(req: FlowHiCommentReq): AxiosPromise<FlowHiCommentList> {
    const tenant = useUserStore().user.tenant;
    return request({
      url: "/v1/flow/hicomment/list/" + tenant + "/" + req.procInstId,
      method: "get",
    });
  }
}
const commentApi = new CommentApiImpl();

export { commentApi };
